import request from '@/config/axios'

// 面试槽位 VO
export interface InterviewSlotVO {
  id: number // 主键
  batchId: string // 计划ID
  interviewId: string // 面试ID
  daytime: string // 上午/下午
  startTime: string // 开始时间
  endTime: string // 结束时间
  remark: string // 备注
}

// 面试槽位修改下拉 VO
export interface InterviewSlotAvailableListRespVO extends InterviewSlotVO {
  disabled: boolean // 是否禁用
}

// 面试槽位 API
export const InterviewSlotApi = {
  // 查询面试槽位分页
  getInterviewSlotPage: async (params: any) => {
    return await request.get({ url: `/recruit/interview-slot/page`, params })
  },

  // 查询面试槽位详情
  getInterviewSlot: async (id: number) => {
    return await request.get({ url: `/recruit/interview-slot/get?id=` + id })
  },

  // 新增面试槽位
  createInterviewSlot: async (data: InterviewSlotVO) => {
    return await request.post({ url: `/recruit/interview-slot/create`, data })
  },

  // 修改面试槽位
  updateInterviewSlot: async (data: InterviewSlotVO) => {
    return await request.put({ url: `/recruit/interview-slot/update`, data })
  },

  // 删除面试槽位
  deleteInterviewSlot: async (id: number) => {
    return await request.delete({ url: `/recruit/interview-slot/delete?id=` + id })
  },

  // 导出面试槽位 Excel
  exportInterviewSlot: async (params) => {
    return await request.download({ url: `/recruit/interview-slot/export-excel`, params })
  },

  // 查询面试槽位分页
  getInterviewSlotSelectListByInterviewId: async (interviewId: string) => {
    return await request.get({
      url: `/recruit/interview-slot/select-list?interviewId=${interviewId}`
    })
  },

  // 查询指定分组内的面试槽位占用情况
  getInterviewSlotAvailableInfoList: async (groupId: string) => {
    return await request.get({
      url: `/recruit/interview-slot/available-slot-list?groupId=${groupId}`
    })
  }
}
